/******************** (C) COPYRIGHT 2010 NXP Semiconductors************
* File Name          : main.c
* Author             : NXP Semiconductors
* Date First Issued  : 01/18/2010
* Description        : Main program body.
*******************************************************************************
*******************************************************************************
* History:
* 01/18/2010		 : V1.0		   initial version
*******************************************************************************/

/* Includes ------------------------------------------------------------------*/
#include "LPC11xx.h"                        /* LPC11xx definitions */
#include "timer32.h"
#include "gpio.h"
		

/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* 0 or 1 for 32-bit timers only */
#define TEST_TIMER_NUM		0		
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/


extern volatile uint32_t timer32_0_counter;
extern volatile uint32_t timer32_1_counter;


/**
  * @brief  main body
  * @param  None
  * @retval None
  */
int main (void) {
  SystemInit();

  /* TEST_TIMER_NUM is either 0 or 1 for 16-bit timer 0 or 1. */
  init_timer32(TEST_TIMER_NUM, TIME_INTERVAL);
  enable_timer32(TEST_TIMER_NUM);

  /* Enable AHB clock to the GPIO domain. */
  LPC_SYSCON->SYSAHBCLKCTRL |= (1<<6);
  
  /* Set port 2_0 to output */
  GPIOSetDir( 2, 9, 1 );

  /* Loop forever */
  while (1)                                
  {
     /* I/O configuration and LED setting pending. */	
	if ( (timer32_0_counter > 0) && (timer32_0_counter <= 50) )
	{
	  GPIOSetValue( 2, 9, 0 );
	}
	if ( (timer32_0_counter > 50) && (timer32_0_counter <= 100) )
	{
	  GPIOSetValue( 2, 9, 1 );
	}
	else if ( timer32_0_counter > 100 )
	{
	  timer32_0_counter = 0;
	}
  }
}

/**
  * @}
  */ 

/**
  * @}
  */ 

/************* (C) COPYRIGHT 2010 NXP Semiconductors*****END OF FILE****/
